package com.dingwen.stusprbooes.config;

import com.dingwen.stusprbooes.constant.ElasticsearchConstant;
import lombok.Builder;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;

/**
 * es 配置类
 *
 * @author dingwen
 * 2021/6/27 20:45
 **/
public class ElasticsearchConfig {

    @Bean
    public RestHighLevelClient restHighLevelClient() {
        return new RestHighLevelClient(RestClient.builder(new HttpHost(ElasticsearchConstant.HOST, ElasticsearchConstant.PORT, ElasticsearchConstant.SCHEME)));
    }
}
